package com.usoft6;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

/**
 * Created by liyanxin on 2015/1/13.
 */
public class WithOnlyPathDemo {

    public static void main(String args[]) {

        Config firstConfig = ConfigFactory.load("complex1.conf");
        Config secondConfig = ConfigFactory.load("complex2.conf");
        //a.withFallback(b)  a和b合并，如果有相同的key，以a为准
        Config finalConfig = firstConfig.withOnlyPath("complex-app.simple-lib-context").withFallback(secondConfig);
        System.out.println(finalConfig.getString("complex-app.something")); //hello world
        System.out.println("simple-lib.foo"); //这个配置项是在complex2.conf中的
    }
}
